

CXX = g++
CC = gcc
LD = ld

# LDFLAGS=


# include $(PRJ_PATH)/Makefile.env

# common-obj += libvixl/

libvixl_OBJS = utils.o \
               a64/instructions-a64.o \
               a64/decoder-a64.o \
               a64/disasm-a64.o
obj := libvixl
libvixl_OBJS := $(addprefix $(obj)/,$(libvixl_OBJS))

obj := disas
libvixl_OBJS := $(addprefix $(obj)/,$(libvixl_OBJS))

# libvixl_OBJS += arm-a64.o

libvixldir = disas/libvixl
arm-a64.o-cflags := -I$(libvixldir) 
CFLAGS += -I$(libvixldir) -Idisas/include

common-obj += test.o disas/arm-a64.o
common-obj += $(libvixl_OBJS)



target: $(common-obj) 
	$(CXX) $^ -o test

# %.d:
# %.h:
# %.c:
# %.cc:
# %.cpp:
# %.m:
# %.mak:


%.o: %.c
	$(V) $(CC) $($@-cflags) $(CFLAGS) -c -o $@ $<

%.o: %.cpp
	$(V) $(CXX) $($@-cflags) $(CXXFLAGS) $(CFLAGS) -c -o $@ $<

%.o: %.cc
	$(V) $(CXX) $($@-cflags) $(CXXFLAGS) $(CFLAGS) -c -o $@ $<

# %/: %
# 	echo $@
	# $(MAKE) -C $<


clean:
	find . -name "*.o" -exec rm {} \;
	find . -name "*.d" -exec rm {} \;
	# find . -name "*.o" -exec rm {} \;